<h1>Editing contact</h1>

<% form_for(@contact) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :firstname %>
    <%= f.text_field :firstname %>
  </p>
  <p>
    <%= f.label :user_id %>
	<% users = User.all %>
    <%= f.select(:user_id, users.collect {|c| [c.login, c.id] },:selected => @contact.user_id, :include_blank => true)%>
  </p>
  <p>
    <%= f.label :company_id %>
	<% companies = Company.all %>
    <%= f.select(:company_id, companies.collect {|c| [c.name, c.id] },:selected => @contact.company_id, :include_blank => true)%>
  </p>
  <p>
    <%= f.label :mail %>
    <%= f.text_field :mail %>
  </p>
  <p>
    <%= f.label :phone_num %>
    <%= f.text_field :phone_num %>
  </p>
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>

	<% link_to @contact, :class => "ui-state-default ui-corner-all dialog_link" do %>
			<span class="ui-icon ui-icon-search"></span>View
	<% end %>&nbsp;
	<% link_to contacts_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
		<span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>Back
	<% end %>
